package com.mm.rabbitmq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MmSender {
    @Autowired
    private AmqpTemplate amqpTemplate;

    //发送一个字符串到名为"mmRabbitMQ"的队列中
    public void send(){
        String context = "MmSender text";
        System.out.println("Sender context :" + context);
        this.amqpTemplate.convertAndSend("mmRabbitMQ", context);
    }
}
